package cn.donting.jme.edit.ui.scenetree.meum.light;

import cn.donting.jme.edit.ui.inspector.InspectorView;
import cn.donting.jme.edit.ui.scenetree.ClipBoard;
import cn.donting.jme.edit.ui.scenetree.meum.AbsTreeMenuItem;
import com.jme3.light.AmbientLight;
import com.jme3.scene.Spatial;

public class AmbientLightMenuItem extends AbsTreeMenuItem {
    public AmbientLightMenuItem() {
        super("环境光");
    }

    @Override
    public boolean isAvailable(ClipBoard clipBoard) {
        return true;
    }

    @Override
    public void action(ClipBoard clipBoard) {
        Spatial selectSpatial = clipBoard.getSelectSpatial();
        selectSpatial.addLight(new AmbientLight());
        InspectorView.getInstance().update(selectSpatial);
    }
}
